//
//  AssistViewController.m
//  jingjing2.0
//
//  Created by apple on 16/5/22.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "AssistViewController.h"
#import "ProblemFeedBackViewController.h"

@interface AssistViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView * mainTableView;
@property (nonatomic,strong)NSArray      * dataArray;
@end

@implementation AssistViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"帮助与反馈";
    self.view.backgroundColor = GRAYCOLOR;
    _dataArray = @[@"服务范围",@"服务流程",@"常见问题",@"意见反馈"];
    [self.view addSubview:self.mainTableView];
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [GeneralTool hideTabBar];
    
}
-(void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    
    [GeneralTool showTabBar];
}
-(UITableView *)mainTableView
{
    if (!_mainTableView)
    {
        _mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 10,kWidth, kHeight-10) style:UITableViewStylePlain];
        _mainTableView.delegate = self;
        _mainTableView.dataSource = self;
        _mainTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
        _mainTableView.backgroundColor = GRAYCOLOR;
        _mainTableView.tableFooterView = [UIView new];//设置当数据不多的时候，下面无cell
        _mainTableView.sectionHeaderHeight = 0;
        _mainTableView.sectionFooterHeight = 0;
    }
    return _mainTableView;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        cell.backgroundColor = [UIColor whiteColor];
        cell.selectionStyle  = UITableViewCellSelectionStyleNone;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    cell.textLabel.text = _dataArray[indexPath.row];
    return cell;
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.row == 0)
    {
        WebViewController *web=[[WebViewController alloc]init];
        web.hidesBottomBarWhenPushed=YES;
        web.title=_dataArray[indexPath.row];
        web.pageUrl=@"http://webapi.iamjingjing.com/article/ServiceArea.aspx";
        [self.navigationController pushViewController:web animated:YES];
    }
    if (indexPath.row == 1)
    {
        WebViewController *web=[[WebViewController alloc]init];
        web.hidesBottomBarWhenPushed=YES;
        web.title=_dataArray[indexPath.row];
        web.pageUrl=@"http://webapi.iamjingjing.com/article/ServiceProcess.htm";
        [self.navigationController pushViewController:web animated:YES];
    }
    if (indexPath.row == 2)
    {
        WebViewController *web=[[WebViewController alloc]init];
        web.hidesBottomBarWhenPushed=YES;
        web.title=_dataArray[indexPath.row];
        web.pageUrl=QUESTIONLIST;
        [self.navigationController pushViewController:web animated:YES];
    }
    if (indexPath.row == 3)
    {
        //意见反馈
        ProblemFeedBackViewController * vc = [[ProblemFeedBackViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
